<template>
  <el-form
      ref="elForm"
      v-model="formData"
      v-bind="$attrs"
      v-on="$listeners"
      :size="preferences.FormSize"
      :label-width="labelAuto"
  >
    <template v-if="$slots['default']" slot="default">
      <slot name="default"></slot>
    </template>
  </el-form>
</template>

<script>
export default {
  name: "MForm",
  data() {
    return {
      formData: null
    }
  },
  model:{
    prop: 'value'
  },
  props: {
    value:{
      type: Object
    },
    labelAuto:{
      type: String,
      default: 'auto'
    }
  },
  watch:{
    value:{
      handler(e){
        this.formData = e
      },
      immediate: true
    }
  },
  mounted() {
  },
  methods: {
    validate(){
      this.$refs.elForm.validate(...arguments)
    },
    validateField(){
      this.$refs.elForm.validateField(...arguments)
    },
    resetFields(){
      this.$refs.elForm.resetFields(...arguments)
    },
    clearValidate(){
      this.$refs.elForm.clearValidate(...arguments)
    }
  }
}
</script>

<style lang="scss" scoped>

</style>